<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  // const fn = (function(){
  //   let name = 10;
  //   let age = 20;

  //   return {
  //     getName:function(){
  //       return name;
  //     },
  //     setName:function(d){
  //       name = d
  //     },
  //     getAge:function(){},
  //     setAge:function(val){}
  //   }
  // })();

  // console.log( fn.get() );
  // fn.set("hello")
  // console.log( fn.get() );

  const fn = (function(){
    let name = "admin";
    let age = 20;

    return {
      get name(){
        return name;
      },
      set name(d){
        name = d;
      },
      get age(){
        return age;
      },
      set age(val){
        age = val;
      }
    }
  })();

  console.log( fn.name );
  console.log( fn.age );
  
  fn.name = "zhangsan"
  fn.age = 30
  
  console.log( fn.name );
  console.log( fn.age );

  
</script>
</html>